package cn.com.sina.finance.todolist.base;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

/**
 * @author yuebo
 * @date 2023/7/28
 */
public class Tab {

    private String title;
    /**
     * 用于FragmentPagerAdapter，每页为fragment
     */
    private Fragment fragment;
    /**
     * 用于PagerAdapter，每页为view
     */
    private View view;
    /**
     * tab唯一标识，用于tab定位
     */
    private String tabId;
    /**
     * 绑定的扩展数据
     */
    private Object dataObject;

    public Tab(String title, Fragment fragment) {
        this.fragment = fragment;
        this.title = title;
    }

    public Tab(String title, Fragment fragment, String tabId) {
        this.title = title;
        this.fragment = fragment;
        this.tabId = tabId;
    }

    public Tab(View view) {
        this.view = view;
    }

    public Tab(String title, View view) {
        this.title = title;
        this.view = view;
    }

    public Tab(View view, String tabId) {
        this.view = view;
        this.tabId = tabId;
    }

    @NonNull
    public Fragment getFragment() {
        return fragment;
    }

    public View getView() {
        return view;
    }

    public String getTitle() {
        return title;
    }

    public String getTabId() {
        return tabId;
    }

    public Object getDataObject() {
        return dataObject;
    }

    public void setDataObject(Object dataObject) {
        this.dataObject = dataObject;
    }
}
